﻿using CodeGenerator.Models.TemplateModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CodeGenerator.Forms
{
    public partial class GeneratorOps : Form
    {
        public DtoFileModel DTOModel { get; }
        public GeneratorOptions Options { get; private set; } = new GeneratorOptions();
        public GeneratorOps(DtoFileModel dto)
        {
            DTOModel = dto;
            InitializeComponent();
        }
        private void GeneratorOps_Load(object sender, EventArgs e)
        {
            if (DTOModel.ClassPropertys == null || DTOModel.ClassPropertys.Count < 1)
            {
                return;
            }
            //绑定属性列表

            this.dataGridView1.DataSource = DTOModel.ClassPropertys;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DTOModel.ClassPropertys = this.dataGridView1.DataSource as List<ClassProperty>;

            Options.IsGeneratorDomain = this.checkBox1.Checked;
            Options.IsCover = this.checkBox2.Checked;
            Options.IsGeneratorView = this.checkBox3.Checked;
            Options.IsGeneratorDTO = this.checkBox4.Checked;
            Options.IsGeneratorAppService = this.checkBox5.Checked;
            Options.IsGeneratorController= this.checkBox6.Checked;
        }

    }
}
